package com.example.reagent_management.di;

import android.content.Context;

import com.example.lib_base.event.ShareViewModel;
import com.example.reagent_management.AppEvent;
import com.example.reagent_management.room.database.AppDataBase;

import javax.inject.Singleton;

import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModelProvider;
import androidx.work.WorkManager;
import dagger.Module;
import dagger.Provides;
import dagger.hilt.InstallIn;
import dagger.hilt.android.qualifiers.ApplicationContext;
import dagger.hilt.components.SingletonComponent;

@InstallIn(SingletonComponent.class)
@Module
public class WorkModule {

    @Singleton
    @Provides
    //由于每次使用WorkManager都要传上下文，而其内部用的应用上下文，故使用注入更方便,实例化一次即可
    public final WorkManager provideAppDatabase(@ApplicationContext @NonNull Context context){
        return WorkManager.getInstance(context);
    }
}
